/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package bo2s.DAO;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author thanhap
 */
public class ConnectionManager {
    
    private static Connection connection;
    private static final String DRIVER = "com.mysql.jdbc.Driver";
    private static final String URL = "jdbc:mysql://localhost:3306/";
    private static final String dbname = "sprint1";
    private static final String usern = "root";
   // private static final String pass = "123456";

    public Connection getConnection() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
        Class.forName(DRIVER).newInstance();
        if (connection == null) {
            connection = DriverManager.getConnection(URL + dbname,usern,"");
        }
        return connection;
    }    
}
